//获取应用实例
var WxParse = require('../../wxParse/wxParse.js');
const app = getApp();
Page({
	data: { 
    urlList:[]
  },
  getDeviceInfo: function () {
    let that = this
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          deviceW: res.windowWidth,
          deviceH: res.windowHeight
        })
      }
    })
  },

  onReady(){
    this.getDeviceInfo();
  },
	onLoad: function(options) {
    var that=this;
    that.genRpPromUrl();
  },

  onShow:function(){
    var that=this;
  },

  //获取首页新人红包等接口
  genRpPromUrl() {
    wx.showLoading({
      title: '加载中',
      mask: false
    })
    var that = this;
    wx.request({
      url: app.globalData.api + '/app.php?c=Pdd&a=genRpPromUrl',
      data: {
        token: app.globalData.token,
        channel_type: '-1'
      },
      header: {
        'Content-type': 'application/x-www-form-urlencoded',
        'platform': '' + app.globalData.platform,
        'version': '' + app.globalData.version,
      },
      method: 'POST',
      dataType: 'json',
      success: function (res) {
        console.log(res);
        wx.hideLoading();
        that.setData({
          urlList: res.data.data.rp_promotion_url_generate_response.resource_list
        })
        console.log(that.data.urlList)
      },
      fail: function () {
        wx.hideLoading();
      }
    });
  },
});
